/**
 * Copyright (c) 2024 Hunan OpenValley Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OHOS_GPUIMAGELEVELSFILTER_H
#define OHOS_GPUIMAGELEVELSFILTER_H
#include "GPUImageFilter.h"

class GPUImageLevelsFilter : public GPUImageFilter {
public:
    static const std::string LEVELS_FRAGMET_SHADER;
    GPUImageLevelsFilter();
    GPUImageLevelsFilter(float *min, float *mid, float *max, float *minOut,
                         float *maxOut);
    ~GPUImageLevelsFilter();
    void onInit() override;
    void onInitialized() override;
    void updateUniforms();
    void setMin(float min, float mid, float max, float minOut, float maxOut);
    void setMin(float min, float mid, float max);
    void setRedMin(float min, float mid, float max, float minOut, float maxOut);
    void setRedMin(float min, float mid, float max);
    void setGreenMin(float min, float mid, float max, float minOut, float maxOut);
    void setGreenMin(float min, float mid, float max);
    void setBlueMin(float min, float mid, float max, float minOut, float maxOut);
    void setBlueMin(float min, float mid, float max);

private:
    int minLocation;
    float *min = nullptr;
    int midLocation;
    float *mid = nullptr;
    int maxLocation;
    float *max = nullptr;
    int minOutputLocation;
    float *minOutput = nullptr;
    int maxOutputLocation;
    float *maxOutput = nullptr;
};

#endif // OHOS_GPUIMAGELEVELSFILTER_H
